
//
//  CourseNewsCell.m
//  ShowYork
//
//  Created by hxh on 2020/8/28.
//  Copyright © 2020 hxh. All rights reserved.
//

#import "LessonNewsCell.h"

@interface LessonNewsCell ()
@property (nonatomic,strong)UIImageView *newsImgView;
@property (nonatomic,strong)UILabel *newslb;
@property (nonatomic,strong)UIView *containView;
@property (nonatomic,strong)UIButton *allBtn;
@end

@implementation LessonNewsCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setUI];
    }
    return self;
}

- (void)setUI{
    
    self.containView = [[UIView alloc]init];
    self.containView.backgroundColor = RGBA(248, 248, 248, 1);
    self.containView.layer.cornerRadius = 18;
    self.containView.layer.masksToBounds = YES;
    [self.contentView addSubview:self.containView];
    
    [self.containView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(15);
        make.height.mas_equalTo(36).priorityHigh();
        make.left.mas_equalTo(self.contentView).offset(15);
        make.right.equalTo(self.contentView).offset(-15);
        make.bottom.equalTo(self.contentView);
    }];
    
    
    self.newsImgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"course_news"]];
    [self.containView addSubview:self.newsImgView];
    [self.newsImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.containView).offset(16);
        make.centerY.equalTo(self.containView);
        make.size.mas_equalTo(CGSizeMake(56, 17));
    }];
    self.allBtn = [[UIButton alloc]init];
    [self.allBtn setTitle:@"全部" forState:UIControlStateNormal];
    [self.allBtn setTitleColor:RGBA(211, 58, 49, 1) forState:UIControlStateNormal];
    [self.allBtn addTarget:self action:@selector(allMethod) forControlEvents:UIControlEventTouchUpInside];
    self.allBtn.titleLabel.font = font(12);
    [self.containView addSubview:self.allBtn];
    
    [self.allBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.top.bottom.equalTo(self.containView);
        make.width.mas_equalTo(60);
    }];
    
    self.newslb = [[UILabel alloc]init];
    self.newslb.text = @"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    self.newslb.textColor = RGBA(51, 51, 51, 1);
    self.newslb.font = font(14);
    [self.contentView addSubview:self.newslb];
    [self.newslb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.containView);
        make.left.equalTo(self.newsImgView.mas_right).offset(8);
        make.right.equalTo(self.allBtn.mas_left);
    }];
}
+(instancetype)cellWithTableView:(UITableView *)tableView{
    NSString *ID = @"LessonNewsCell";
    LessonNewsCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[LessonNewsCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
}

- (void)allMethod{
    
}

@end
